package com.nbcio.pm.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.nbcio.common.tenant.core.TenantEntity;
import com.nbcio.pm.domain.vo.PmProjectDocumentVo;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 项目文档对象 pm_project_document
 *
 * @author nbacheng
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("pm_project_document")
@AutoMapper(target = PmProjectDocumentVo.class, reverseConvertGenerate = false)
public class PmProjectDocument extends TenantEntity {

    /**
     * 文档ID
     */
    @TableId(value = "doc_id", type = IdType.AUTO)
    private Long docId;

    /**
     * 项目ID
     */
    @TableField("project_id")
    private Long projectId;

    /**
     * 任务ID
     */
    @TableField("task_id")
    private Long taskId;

    /**
     * 文档名称
     */
    @TableField("doc_name")
    private String docName;

    /**
     * 文档类型：file-文件，folder-文件夹
     */
    @TableField("doc_type")
    private String docType;

    /**
     * 文件路径
     */
    @TableField("file_path")
    private String filePath;

    /**
     * 文件大小
     */
    @TableField("file_size")
    private Long fileSize;

    /**
     * 文件扩展名
     */
    @TableField("file_extension")
    private String fileExtension;

    /**
     * 版本号
     */
    @TableField("version")
    private String version;

    /**
     * 父文档ID
     */
    @TableField("parent_id")
    private Long parentId;

    /**
     * 排序
     */
    @TableField("sort_order")
    private Integer sortOrder;

    /**
     * 是否公开
     */
    @TableField("is_public")
    private Boolean isPublic;

    /**
     * 下载次数
     */
    @TableField("download_count")
    private Integer downloadCount;

    // 关联字段（非数据库字段）
    @TableField(exist = false)
    private String projectName;

    @TableField(exist = false)
    private String taskName;

    @TableField(exist = false)
    private List<PmProjectDocument> children;
}
